package com.itheima.config;

import com.alibaba.druid.pool.DruidDataSource;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;

import javax.sql.DataSource;

/**
 * @program: Spring_day01_01_IOC入门程序
 * @description:
 * @author: xuejingjing
 * @create: 2021-08-01 15:24
 **/

public class JDBCConfig {

    @Value("${jdbc.driver}")
    private String driver;
    @Value("${jdbc.url}")
    private String url;
    @Value("${jdbc.userName}")
    private String userName;
    @Value("${jdbc.password}")
    private String passWord;


    @Bean("dataSource")
    public DataSource getDataSource(){
        DruidDataSource dds = new DruidDataSource();
        dds.setDriverClassName("driver");
        dds.setUrl("url");
        dds.setUsername("userName");
        dds.setPassword("passWord");
        return dds;
    }
}
